//
// Created by 11510 on 2024/7/30.
//

#ifndef WEB_DEDUPLICATION_SPLITTOOLCPPJIEBA_H
#define WEB_DEDUPLICATION_SPLITTOOLCPPJIEBA_H
#include "SplitTool.h"
#include "cppjieba/Jieba.hpp"
#include "Configuration.h"
#include <vector>

class SplitToolCppJieba: public SplitTool{
private:
    cppjieba::Jieba* jieba;

public:
    SplitToolCppJieba(const Configuration &configuration){
        jieba = new cppjieba::Jieba(configuration.getDictPath(),
                                    configuration.getHmmPath(),
                                    "");
    }
    ~SplitToolCppJieba(){
        if (jieba){
            delete jieba;
            jieba = nullptr;
        }
    }

    void cutWords(std::string& sentence, std::vector<std::string >& list) override {
        jieba->Cut(sentence, list, true);
    }
};


#endif //WEB_DEDUPLICATION_SPLITTOOLCPPJIEBA_H
